<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>壁纸APP - 视频</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: #f5f5f5;
            color: #333;
        }

        /* 顶部标题栏 */
        .header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 44px;
            background: #fff;
            padding: 8px 16px;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            z-index: 100;
        }

        .header-actions {
            display: flex;
            gap: 20px;
        }

        .header-actions i {
            font-size: 18px;
            color: #333;
        }

        /* 搜索栏 */
        .search-container {
            padding: 16px 16px 0;
            margin-top: 44px;
        }
        
        .search-box {
            display: flex;
            margin-bottom: 15px;
        }
        
        .search-input {
            flex: 1;
            border: 1px solid #ddd;
            border-radius: 20px 0 0 20px;
            outline: none;
            font-size: 14px;
            padding: 8px 16px;
            background: #fff;
        }

        .search-button {
            background: #4285F4;
            color: white;
            border: none;
            border-radius: 0 20px 20px 0;
            padding: 0 20px;
            font-size: 14px;
            cursor: pointer;
        }
        
        .category-label {
            font-size: 14px;
            font-weight: 500;
            margin-bottom: 8px;
            color: #333;
        }
        
        .tag-container {
            display: flex;
            flex-wrap: nowrap;
            gap: 8px;
            margin-bottom: 15px;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            padding: 5px 0;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        .tag-container::-webkit-scrollbar {
            display: none;
        }

        .primary-tags {
            margin-bottom: 10px;
        }
        
        .tag {
            background: #fff;
            border-radius: 16px;
            padding: 4px 12px;
            font-size: 14px;
            color: #666;
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
        }
        
        .tag.active {
            background: #4285F4;
            color: #fff;
        }

        .round-tag {
            border-radius: 50px;
            background: #f0f0f0;
            color: #333;
            padding: 6px 15px;
        }

        .round-tag.active {
            background: #4285F4;
            color: #fff;
        }

        /* 视频列表 */
        .video-grid {
            padding: 16px;
            display: grid;
            grid-template-columns: repeat(1, 1fr);
            gap: 16px;
            margin-bottom: 60px;
        }

        .video-item {
            background: #fff;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
            transition: all 0.3s ease;
            animation: fadeIn 0.5s ease;
        }

        .video-thumbnail {
            position: relative;
            aspect-ratio: 16/9;
            background: #f0f0f0;
            overflow: hidden;
        }

        .video-thumbnail img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s ease;
        }

        .play-icon {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 50px;
            height: 50px;
            background: rgba(0, 0, 0, 0.5);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 20px;
            opacity: 0.8;
            transition: all 0.3s ease;
        }

        .video-duration {
            position: absolute;
            bottom: 8px;
            right: 8px;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 12px;
        }

        .video-info {
            padding: 12px;
        }

        .video-title {
            font-size: 16px;
            font-weight: 500;
            margin-bottom: 4px;
        }

        .video-meta {
            display: flex;
            justify-content: space-between;
            color: #999;
            font-size: 12px;
        }

        .video-views, .video-likes {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        /* 视频详情页 */
        .video-detail {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 49px;
            background: #f5f5f5;
            z-index: 101;
            overflow-y: auto;
        }

        .video-detail.active {
            display: block;
            animation: fadeIn 0.3s ease;
        }

        .detail-header {
            height: 44px;
            background: #fff;
            display: flex;
            align-items: center;
            padding: 0 16px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }

        .back-button {
            font-size: 18px;
            margin-right: 16px;
            color: #007AFF;
        }

        .detail-title {
            font-size: 18px;
            font-weight: 500;
        }

        .video-player-container {
            width: 100%;
            background: #000;
            position: relative;
        }

        .video-player {
            width: 100%;
            aspect-ratio: 16/9;
            background: #000;
        }

        .video-controls {
            padding: 16px;
            background: #fff;
            border-bottom: 1px solid #f0f0f0;
        }

        .video-actions {
            display: flex;
            justify-content: space-around;
            margin-top: 12px;
        }

        .video-action {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #666;
            font-size: 12px;
            gap: 4px;
        }

        .video-action i {
            font-size: 20px;
            color: #007AFF;
        }

        .video-description {
            padding: 16px;
            background: #fff;
            margin: 10px 0;
        }

        .description-title {
            font-size: 16px;
            font-weight: 500;
            margin-bottom: 8px;
        }

        .description-content {
            font-size: 14px;
            color: #666;
            line-height: 1.5;
        }

        .related-videos {
            padding: 16px;
            background: #fff;
        }

        .related-title {
            font-size: 16px;
            font-weight: 500;
            margin-bottom: 12px;
        }

        .related-list {
            display: grid;
            grid-template-columns: repeat(1, 1fr);
            gap: 12px;
        }

        .related-item {
            display: flex;
            gap: 10px;
            padding-bottom: 10px;
            border-bottom: 1px solid #f0f0f0;
        }

        .related-thumbnail {
            width: 120px;
            aspect-ratio: 16/9;
            border-radius: 8px;
            overflow: hidden;
            position: relative;
        }

        .related-thumbnail img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .related-duration {
            position: absolute;
            bottom: 4px;
            right: 4px;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 1px 4px;
            border-radius: 2px;
            font-size: 10px;
        }

        .related-info {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .related-video-title {
            font-size: 14px;
            font-weight: 500;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .related-meta {
            font-size: 12px;
            color: #999;
        }

        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 49px;
            background: #fff;
            display: flex;
            justify-content: space-around;
            align-items: center;
            box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #666;
            font-size: 12px;
            text-decoration: none;
        }

        .nav-item.active {
            color: #007AFF;
        }

        /* 动画效果 */
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .video-item:nth-child(n) {
            animation-delay: calc(0.1s * var(--i, 0));
        }
    </style>
</head>
<body>
    <!-- 顶部标题栏 -->
    <div class="header">
        <div class="header-actions">
            <i class="fas fa-th-large"></i>
            <i class="fas fa-ellipsis-h"></i>
        </div>
    </div>
    
    <!-- 搜索和标签筛选 -->
    <div class="search-container">
        <div class="search-box">
            <input type="text" class="search-input" placeholder="搜索视频..." id="search-input">
            <button class="search-button">搜索</button>
        </div>
        <div class="category-label">视频分类</div>
        <div class="tag-container">
            <div class="tag round-tag active" data-tag="all">全部</div>
            <div class="tag round-tag" data-tag="nature">风景</div>
            <div class="tag round-tag" data-tag="animal">动物</div>
            <div class="tag round-tag" data-tag="city">城市</div>
            <div class="tag round-tag" data-tag="people">人物</div>
            <div class="tag round-tag" data-tag="sports">运动</div>
            <div class="tag round-tag" data-tag="food">美食</div>
            <div class="tag round-tag" data-tag="art">艺术</div>
            <div class="tag round-tag" data-tag="music">音乐</div>
        </div>
    </div>

    <!-- 视频列表 -->
    <div class="video-grid" id="video-container">
        <div class="video-item" data-category="nature" data-tags="film,nature">
            <div class="video-thumbnail">
                <img src="https://images.unsplash.com/photo-1501854140801-50d01698950b?ixlib=rb-1.2.1&auto=format&fit=crop&w=600&q=80" alt="瀑布视频">
                <div class="play-icon"><i class="fas fa-play"></i></div>
                <div class="video-duration">2:45</div>
            </div>
            <div class="video-info">
                <div class="video-title">瀑布</div>
                <div class="video-meta">
                    <div class="video-views">486804 次观看</div>
                    <div class="video-likes">2087 赞</div>
                </div>
            </div>
        </div>
        <div class="video-item" data-category="nature" data-tags="film,nature">
            <div class="video-thumbnail">
                <img src="https://images.unsplash.com/photo-1513836279014-a89f7a76ae86?ixlib=rb-1.2.1&auto=format&fit=crop&w=600&q=80" alt="云海视频">
                <div class="play-icon"><i class="fas fa-play"></i></div>
                <div class="video-duration">3:12</div>
            </div>
            <div class="video-info">
                <div class="video-title">多雾路段</div>
                <div class="video-meta">
                    <div class="video-views">31497 次观看</div>
                    <div class="video-likes">444 赞</div>
                </div>
            </div>
        </div>
        <div class="video-item" data-category="animals" data-tags="film,animals">
            <div class="video-thumbnail">
                <img src="https://images.unsplash.com/photo-1474511320723-9a56873867b5?ixlib=rb-1.2.1&auto=format&fit=crop&w=600&q=80" alt="狐狸视频">
                <div class="play-icon"><i class="fas fa-play"></i></div>
                <div class="video-duration">1:58</div>
            </div>
            <div class="video-info">
                <div class="video-title">狐狸特写</div>
                <div class="video-meta">
                    <div class="video-views">128745 次观看</div>
                    <div class="video-likes">1254 赞</div>
                </div>
            </div>
        </div>
        <div class="video-item" data-category="travel" data-tags="film,travel">
            <div class="video-thumbnail">
                <img src="https://images.unsplash.com/photo-1502602898657-3e91760cbb34?ixlib=rb-1.2.1&auto=format&fit=crop&w=600&q=80" alt="巴黎视频">
                <div class="play-icon"><i class="fas fa-play"></i></div>
                <div class="video-duration">4:23</div>
            </div>
            <div class="video-info">
                <div class="video-title">巴黎之旅</div>
                <div class="video-meta">
                    <div class="video-views">245689 次观看</div>
                    <div class="video-likes">3421 赞</div>
                </div>
            </div>
        </div>
    </div>

    <!-- 视频详情页 -->
    <div class="video-detail" id="video-detail">
        <div class="detail-header">
            <span class="back-button"><i class="fas fa-arrow-left"></i></span>
            <h2 class="detail-title">视频标题</h2>
        </div>
        <div class="video-player-container">
            <video class="video-player" id="video-player" controls>
                <source src="" type="video/mp4">
                您的浏览器不支持视频播放。
            </video>
        </div>
        <div class="video-controls">
            <h3 id="detail-video-title">视频标题将在这里显示</h3>
            <div class="video-actions">
                <div class="video-action">
                    <i class="fas fa-thumbs-up"></i>
                    <span>点赞</span>
                </div>
                <div class="video-action">
                    <i class="fas fa-share"></i>
                    <span>分享</span>
                </div>
                <div class="video-action">
                    <i class="fas fa-download"></i>
                    <span>下载</span>
                </div>
                <div class="video-action">
                    <i class="fas fa-star"></i>
                    <span>收藏</span>
                </div>
            </div>
        </div>
        <div class="video-description">
            <div class="description-title">视频简介</div>
            <div class="description-content" id="video-description">
                视频描述将在这里显示。
            </div>
        </div>
        <div class="related-videos">
            <div class="related-title">相关推荐</div>
            <div class="related-list" id="related-videos">
                <!-- 相关视频将通过JavaScript动态添加 -->
            </div>
        </div>
    </div>

    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="index.html" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="category.html" class="nav-item">
            <i class="fas fa-th-large"></i>
            <span>分类</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-play-circle"></i>
            <span>视频</span>
        </a>
        <a href="my.html" class="nav-item">
            <i class="fas fa-user"></i>
            <span>我的</span>
        </a>
    </div>

    <script>
        // 获取DOM元素
        const videoContainer = document.getElementById('video-container');
        const videoDetail = document.getElementById('video-detail');
        const detailTitle = document.querySelector('.detail-title');
        const videoPlayer = document.getElementById('video-player');
        const detailVideoTitle = document.getElementById('detail-video-title');
        const videoDescription = document.getElementById('video-description');
        const relatedVideos = document.getElementById('related-videos');
        const backButton = document.querySelector('.back-button');
        const searchInput = document.getElementById('search-input');
        const primaryTags = document.querySelectorAll('.primary-tags .tag');
        const secondaryTags = document.querySelectorAll('.secondary-tags .tag');

        // 点击视频项，跳转到预览页面
        videoContainer.addEventListener('click', (e) => {
            const videoItem = e.target.closest('.video-item');
            if (!videoItem) return;
            
            const videoTitle = videoItem.querySelector('.video-title').textContent;
            const videoImg = videoItem.querySelector('img').src;
            
            // 跳转到预览页面
            window.location.href = `preview.html?title=${encodeURIComponent(videoTitle)}&thumbnail=${encodeURIComponent(videoImg)}`;
        });

        // 返回按钮，隐藏视频详情
        backButton.addEventListener('click', () => {
            videoDetail.classList.remove('active');
        });

        // 显示视频详情
        function showVideoDetail(title, thumbnailSrc) {
            videoDetail.classList.add('active');
            detailTitle.textContent = title;
            detailVideoTitle.textContent = title;
            
            // 设置视频播放器
            // 注意：这里使用了一个示例视频URL，实际应用中应该使用真实的视频URL
            videoPlayer.src = 'https://samplelib.com/lib/preview/mp4/sample-5s.mp4';
            
            // 设置视频描述
            videoDescription.textContent = `这是关于${title}的精彩视频，展示了令人惊叹的画面和内容。`;
            
            // 生成相关视频推荐
            generateRelatedVideos(title);
        }

        // 生成相关视频推荐
        function generateRelatedVideos(currentTitle) {
            // 清空现有推荐
            relatedVideos.innerHTML = '';
            
            // 添加3个相关视频推荐
            const relatedTitles = [
                '山间小溪', '城市夜景', '海滩日落'
            ];
            
            relatedTitles.forEach((title, index) => {
                if (title !== currentTitle) {
                    const relatedItem = document.createElement('div');
                    relatedItem.className = 'related-item';
                    relatedItem.innerHTML = `
                        <div class="related-thumbnail">
                            <img src="https://images.unsplash.com/photo-${1500000000000 + index * 10000}?ixlib=rb-1.2.1&auto=format&fit=crop&w=200&q=80" alt="${title}">
                            <div class="related-duration">2:${index + 10}</div>
                        </div>
                        <div class="related-info">
                            <div class="related-video-title">${title}</div>
                            <div class="related-meta">${Math.floor(Math.random() * 50000)}次观看</div>
                        </div>
                    `;
                    
                    relatedVideos.appendChild(relatedItem);
                }
            });
        }

        // 标签筛选功能
        primaryTags.forEach(tag => {
            tag.addEventListener('click', () => {
                // 移除所有标签的active类
                primaryTags.forEach(t => t.classList.remove('active'));
                // 给当前点击的标签添加active类
                tag.classList.add('active');
                
                // 根据标签筛选视频
                filterVideos();
            });
        });
        
        secondaryTags.forEach(tag => {
            tag.addEventListener('click', () => {
                // 移除所有标签的active类
                secondaryTags.forEach(t => t.classList.remove('active'));
                // 给当前点击的标签添加active类
                tag.classList.add('active');
                
                // 根据标签筛选视频
                filterVideos();
            });
        });

        // 筛选视频
        function filterVideos() {
            const primaryTag = document.querySelector('.primary-tags .tag.active').dataset.tag;
            const secondaryTag = document.querySelector('.secondary-tags .tag.active').dataset.tag;
            
            const videoItems = document.querySelectorAll('.video-item');
            
            videoItems.forEach(item => {
                const itemTags = item.dataset.tags ? item.dataset.tags.split(',') : [];
                const itemCategory = item.dataset.category;
                
                // 判断是否符合筛选条件
                const matchPrimary = primaryTag === 'all' || itemTags.includes(primaryTag);
                const matchSecondary = secondaryTag === 'all' || itemCategory === secondaryTag;
                
                // 显示或隐藏视频项
                if (matchPrimary && matchSecondary) {
                    item.style.display = 'block';
                } else {
                    item.style.display = 'none';
                }
            });
        }

        // 搜索功能
        searchInput.addEventListener('keyup', (e) => {
            if (e.key === 'Enter') {
                const searchText = searchInput.value.toLowerCase().trim();
                
                if (searchText) {
                    const videoItems = document.querySelectorAll('.video-item');
                    
                    videoItems.forEach(item => {
                        const title = item.querySelector('.video-title').textContent.toLowerCase();
                        
                        if (title.includes(searchText)) {
                            item.style.display = 'block';
                        } else {
                            item.style.display = 'none';
                        }
                    });
                }
            }
        });
    </script>
</body>
</html>